﻿<%@ page language="java" pageEncoding="UTF-8"
	errorPage="/ui/defaultException.jsp"%>
<%@include file="/ui/tags.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<title>禅境旅行-首页</title>
    <%@include file="/ui/mobile/head.jsp"%>
    <script type="text/javascript">

    </script>
</head>
<body>
    <div class="page">
        <div class="page-top">
            <div class="page-top-left">
                <a href="${cpath}/mobile/home.do?action=navigate">
                    <!--自己换ICON-->
                    <img src="${cpath}/resources/mobile/img/icon/back.png" height="35" /></a>
            </div>
            <div class="page-top-center">首页</div>
            <div class="page-top-right" style="display: none">
                <a href="首页.html">
                    <img src="img/icon/l.png" height="35" /></a>
            </div>
        </div>
        <div class="page-content">
            <div class="h-list">
            	<c:forEach var="item" items="${homeData }">
            	<c:choose>
            		<c:when test="${item.featureCategoryId == -1}">
            			<c:set var="linkUrl" value="${cpath }/mobile/news.do?action=viewNews&newsId=${item.linkId}" scope="page"/>
            		</c:when>
            		<c:when test="${item.featureCategoryId == -2}">
            			<c:set var="linkUrl" value="${cpath }/mobile/dest.do?action=viewDest&destId=${item.linkId}" scope="page"/>
            		</c:when>
            		<c:when test="${item.featureCategoryId == -3}">
            			<c:set var="linkUrl" value="${cpath }/mobile/hotel.do?action=viewHotel&hotelId=${item.linkId}" scope="page"/>
            		</c:when>
            		<c:otherwise>
            			<c:set var="linkUrl" value="${cpath }/mobile/dest.do?action=navFeatureItem&featureItemId=${item.linkId}" scope="page"/>
            		</c:otherwise>
            	</c:choose>
                <div class="h-mod">
                    <div class="h-mod-img">
                    	<a href="${linkUrl }">
                        <img class="lazy" data-original="${image_domain }${item.origImg}"  src="${cpath}/resources/mobile/img/grey.gif"/>
                        </a>
                        <div class="h-mod-tooltip">${item.featureCategoryName }</div>
                   		<div class="h-mod-area">
	                        <div class="h-mod-area-img">
	                            <img src="${image_domain}${item.countryOrigFlag }" />
	                        </div>
	                        <div class="h-mod-area-info">
	                            ${item.countryName }&nbsp;&nbsp;${item.destName }
	                        </div>
	                        <!--页面需要则加 不需要就删除-->
	                        <div class="h-mod-date"><pt:prettytime date="${item.itemCreateTime }" locale="zh"/></div>
                    	</div>
                    </div>
                    <div class="h-mod-title"><a href="${linkUrl }">${item.title }</a></div>
                </div>
                </c:forEach>
                <div class="clear">
                </div>
                <c:if test="${nextPage > 0 }">
				<div class="click-load">
					<div id="nextPage" nextPage="${nextPage }" />
					<a href="javascript:void(0)"
						onclick="loadNextPage()">
						查看更多 <img src="${cpath}/resources/mobile/img/icon/down.png">
					</a>
				</div>
				<script type="text/javascript">
					var nextPage = 2;
					var loading = false;
					function loadNextPage(){
						if (typeof(nextPage) == "undefined"){
							return;
						}
						if (loading){
							alert("正在加载中...");
						}
						loading = true;
						$.post("${cpath }/mobile/home.do?action=home",{'pageNum':nextPage},function (result){
							//渲染页面
							var $html = $(result);
							var $hmod = $('.h-mod',$html);
							$('.clear').before($hmod);
							$(".lazy").lazyload();
							//alert( $('#nextPage',$html));
							var $nextPage = $('#nextPage',$html).attr('nextPage');
							//alert($nextPage);
							if (typeof($nextPage) == "undefined" ||$nextPage <= 0 ){
								$('.click-load').remove();
								nextPage = 'undefined';
							}else{
								nextPage = $nextPage;
							}
							loading = false;
						},'html');
					}
				</script>
				</c:if>
			</div>
        </div>
    </div>
    <script src="${cpath}/resources/mobile/js/lazyload/jquery.lazyload.js"></script>
    <script type="text/javascript">
    	 $(function() {
    	     $("img.lazy").lazyload();
    	  });
    </script>
    <%@include file="/ui/mobile/footer.jsp"%>
</body>
</html>
